<!-- extend from base layout -->
{% extends "layout.html" %}

{% block extra_css %}

{% endblock %}

{% block content %}
    <div class="container">
    <!-- header -->
    <nav class="sub-header row container-fluid">
        <ol class="breadcrumb">
            <li><a href="/">首页</a></li>
            <li class="active">提现中心</li>
            <li class="active">申请记录</li>
        </ol>
        <div class="btn-group pull-right" role="group" aria-label="...">
            {% if request.query_string == 'status_order=2' %}
            <a type="button" class="btn btn-default" href="{{ url_for('apply.lists_get') }}">处理中</a>
            <a type="button" class="btn btn-default active">已完成</a>
            {% else %}
            <a type="button" class="btn btn-default active">处理中</a>
            <a type="button" class="btn btn-default" href="{{ url_for('apply.lists_get', status_order=2) }}">已完成</a>
            {% endif %}
        </div>
    </nav>

    <hr/>
    <!-- content -->
    <div class="table-responsive">
        {# <table class="table table-striped"> #}
        <table class="table table-hover">
            <thead>
            <tr>
                <th>提现ID</th>
{#                <th>用户ID</th>#}
                <th>申请类型</th>
                <th>申请金额</th>
                <th>订单金额</th>
                <th>申请状态</th>
                <th>订单状态</th>
                <th>删除状态</th>
                <th>申请时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% for apply_get in pagination.items %}
            <tr class="text-muted">
                <td>{{ apply_get.id }}</td>
{#                <td>{{ apply_get.user_id }}</td>#}
                <td>{{ apply_get.type_apply | type_apply }}</td>
                <td>{{ apply_get.money_apply }}</td>
                <td>{{ apply_get.money_order }}</td>
                <td>{{ apply_get.status_apply | status_apply }}</td>
                <td>{{ apply_get.status_order | status_order }}</td>
                <td>{{ apply_get.status_delete | status_delete }}</td>
                <td>{{ moment(apply_get.create_time).format('YYYY-MM-DD HH:mm:ss') }}</td>
                <td>
                    <a href="javascript:void(0);" onclick="apply_get_delete({{ apply_get.id }});" rel="tooltip" title="删除"><span class="glyphicon glyphicon-trash"></span></a>
                </td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
        {# 翻页 #}
        {% from "macros.html" import render_pagination %}
        {{ render_pagination(pagination, 'apply.lists_put') }}
    </div>
    </div>
{% endblock %}

{% block extra_js %}
<script>
    // 提现删除
    function apply_get_delete(apply_get_id){
        if(confirm("删除数据不能恢复，是否确认删除?"))
        {
            // console.log(apply_get_id);
            $.getJSON('{{ url_for('apply.ajax_delete_get') }}',
            {
                apply_get_id: apply_get_id
            }, function (result) {
                if(result.hasOwnProperty('error')){
                    alert(result.error);
                }else {
                    alert(result.success);
                    window.location.reload();
                }
            });
            return false;
        }
    }
</script>
{% endblock %}
